{% assign router = section.router | default: routes.current_route %}
{% if section.settings.is_index_board and router == 'index/index' and section.settings.is_board %}
  {% assign showBoard = true %}
{% elsif section.settings.is_index_board == false and section.settings.is_board %}
  {% assign showBoard = true %}
{% else %}
  {% assign showBoard = false %}
{% endif %}

{% assign data = section.settings %}

{% get_nav nav_id={section.settings.nav.id} %}
{% assign header_nav = nav %}
{% if showBoard %}
  <div id="top-bar" style="--bg-color: {{ data.board_bg }}; --text-color: {{ data.board_font }};">
    <div class="container_wrapper text-center py-3">
      <a href="{{ data.board_link | setUrlDataFrom:data_from }}">{{ data.board_text }} </a>
    </div>
  </div>
{% endif %}

{% include 'oem_header' , data: data , header_nav: header_nav %}

{% include 'mobile_nav', data: data %}

{% include 'header_search',color: data.menu_color,search_text: data.search_placeholder %}
{% schema %}
{
	"tag": "",
	"class": "header",
	"is_global": true,
	"name": {
		"zh_CN": "头部",
		"en_US": "Header"
	},
	"max_blocks": "0",
	"settings": [
		{
			"type": "card_header",
			"label": {
				"zh_CN": "菜单导航设置",
				"en_US": "Menu Navigation Settings"
			}
		},
		{
			"type": "card_nav",
			"label": {
				"zh_CN": "选择菜单",
				"en_US": "Select menu"
			},
			"default": {
				"id": "",
				"title": ""
			},
			"id": "nav"
		},
		{
			"type": "card_header",
			"label": {
				"zh_CN": "公告栏",
				"en_US": "Bulletin board"
			}
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "开启公告栏",
				"en_US": "Turn on the bulletin board"
			},
			"id": "is_board",
			"default": true
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "仅首页显示公告栏",
				"en_US": "Display bulletin board only on home page"
			},
			"id": "is_index_board"
		},
		{
			"type": "card_input",
			"label": {
				"zh_CN": "公告栏文案",
				"en_US": "Bulletin board copy"
			},
			"id": "board_text",
			"default": "We Free Shipping Worldwide."
		},
		{
			"type": "card_page_link",
			"label": {
				"zh_CN": "公告栏链接",
				"en_US": "Bulletin board link"
			},
			"default": {
				"type": "",
				"title": "",
				"url": ""
			},
			"id": "board_link"
		},
		{
			"type": "card_header",
			"label": {
				"zh_CN": "顶部LOGO与图片",
				"en_US": "Top LOGO and image"
			}
		},
		{
			"type": "card_image",
			"label": {
				"zh_CN": "pc端logo图片",
				"en_US": "Logo image on PC"
			},
			"id": "pc_logo_pic",
			"default": ""
		},
		{
			"type": "card_slider",
			"label": {
				"zh_CN": "pc端logo图片宽度",
				"en_US": "Logo image width on PC"
			},
			"id": "pc_logo_w",
			"max": "400",
			"unit": "px",
			"min": "0",
			"default": 60
		},
		{
			"type": "card_image",
			"label": {
				"zh_CN": "移动端logo图片",
				"en_US": "Mobile logo image"
			},
			"id": "wap_logo_pic",
			"default": ""
		},
		{
			"type": "card_slider",
			"label": {
				"zh_CN": "移动端logo图片宽度",
				"en_US": "Mobile logo image width"
			},
			"id": "wap_logo_w",
			"max": "200",
			"unit": "px",
			"min": "0",
			"default": 60
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "个人中心",
				"en_US": "Personal center"
			},
			"id": "is_member",
			"default": "1"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "搜索",
				"en_US": "Search"
			},
			"id": "is_search",
			"default": "1"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "货币切换",
				"en_US": "Currency switch"
			},
			"id": "is_currency",
			"default": "1"
		},
		{
			"type": "card_switch",
			"label": {
				"zh_CN": "货币前展示国旗",
				"en_US": "Display the national flag in front of the currency"
			},
			"id": "is_currency_flag",
			"default": "1"
		},
		{
			"type": "card_input",
			"label": {
				"zh_CN": "搜索底纹",
				"en_US": "Search shading"
			},
			"id": "search_placeholder",
			"default": "Search"
		},
		{
			"type": "card_header",
			"label": {
				"zh_CN": "颜色设置",
				"en_US": "Color Settings"
			}
		},
		{
			"type": "card_color",
			"label": {
				"zh_CN": "公告栏字体",
				"en_US": "Bulletin board font"
			},
			"id": "board_font",
			"default": "#333"
		},
		{
			"type": "card_color",
			"label": {
				"zh_CN": "公告栏背景",
				"en_US": "Bulletin board background"
			},
			"id": "board_bg",
			"default": "#fff"
		},
		{
			"type": "card_color",
			"label": {
				"zh_CN": "搜索栏背景",
				"en_US": "Search bar background"
			},
			"id": "search_bar_bg",
			"default": "#ffffff"
		},
		{
			"type": "card_color",
			"label": {
				"zh_CN": "搜索栏文字颜色",
				"en_US": "Search bar text color"
			},
			"id": "search_bar_color",
			"default": "#323232"
		},
		{
			"type": "card_color",
			"label": {
				"zh_CN": "导航栏背景",
				"en_US": "Navigation bar background"
			},
			"id": "nav_bg",
			"default": "#000000"
		},
		{
			"type": "card_color",
			"label": {
				"zh_CN": "导航栏文字颜色",
				"en_US": "Navigation bar text color"
			},
			"id": "menu_color",
			"default": "#ffffff"
		}
	],
	"blocks": [],
	"default": {
		"settings": {
			"nav": {
				"id": "",
				"title": ""
			},
			"is_board": true,
			"is_index_board": false,
			"board_text": "We Free Shipping Worldwide.",
			"board_link": {
				"type": 0,
				"title": "",
				"url": "",
				"source_id": ""
			},
			"pc_logo_pic": {
				"src": "",
				"alt": ""
			},
			"pc_logo_w": 60,
			"wap_logo_pic": {
				"src": "",
				"alt": ""
			},
			"wap_logo_w": 60,
			"is_member": true,
			"is_search": true,
			"is_currency": true,
			"is_currency_flag": false,
			"board_font": "#b05d5d",
			"board_bg": "#ffe8e8",
			"search_bar_bg": "#FFFFFF",
			"search_bar_color": "#323232",
			"nav_bg": "#232323",
			"search_placeholder": "Search",
			"menu_color": "#ffffff"
		},
		"blocks": [],
		"type": "header"
	}
}
{% endschema %}
